Sodomy is not illegal everywhere. The places that it is, it is not enforced. It's an outdated, unenforced law similar to you can beat your wife for various indiscretions.